import { defineStore } from 'pinia'
import type { Ref } from 'vue'
// import axios from "axios"
export const useCounterStore = defineStore('counter', {
  persist: true,
  state: () => ({ 
    count: 0 ,
    list:[],
    userInfo: {},
    //验证码
    yanzm:"",
    //电话号码
    tel:"",
    //显示底部标签导航
    shownav:true,
    //是否登录状态
    islogin:false,
    userid:"",
}),
  getters: {
    // doubleCount: (state) => state.count * 2,
  },
  actions: {
    // increment() {
    //   this.count++
    // },
    // getlist(){
    //   axios.get("https://cnodejs.org/api/v1/topics").then((res)=>{
    //     console.log(res)
    //     this.list=res.data.data
    //   })
    // }
     //暂储验证码
     chanyzm(payload: string){
        this.yanzm=payload
      },
      chanphonenumber(payload: string){
        this.tel=payload
      },
      //存储登录用户数据
      setUserInfo( payload:any) {
        this.userInfo = payload;
      },
    //修改底部导航是否可见
    channav(payload: boolean){
      this.shownav= payload;
    },
    //修改userid
    chuserid(payloay:string){
      this.userid=payloay
    }
  }
})